In [1]:
from matplotlib.pyplot import *
import matplotlib
from numpy import linspace, sin, exp
from scipy.constants import h
from scipy.optimize import curve_fit
%matplotlib inline
matplotlib.rcParams['savefig.dpi'] = 144
In [2]:
matplotlib.rcParams['savefig.dpi'] = 144
matplotlib.rcParams['savefig.transparent'] = True
matplotlib.rcParams['axes.facecolor'] = '#444444'
matplotlib.rcParams['axes.edgecolor'] = 'w'
matplotlib.rc('xtick',color='w')
matplotlib.rc('ytick', color='w')
In [3]:
def N(power, length, freq):
"""Power in db, pulse length in ns, freq in GHz
"""
p = (10.**(power/10.))/1e3 # Convert to Watts
print("Power: " + str(p) + "Watts")
en = p*(length/1.e9) # Energy in given pulse length
print("Energy: " + str(en) + "Joules")
n = en/(h*freq*1.e9) # Divide by hf in GHz
print("Photons:" + str(int(n)))
return n
In [4]:
def P_switch(P_dark, P_bright, power, length, freq):
n = N(power, length, freq)
p = exp(-n)*P_dark + (1-exp(-n))*P_bright
print("Switching Probability:" + str(p) + "%")
return p
In [5]:
result=P_switch(10, 50, -120., 5, 5)
In [6]:
def contrast(P_dark, P_bright, power, length, freq):
n = N(power, length, freq)
c = (exp(-n)-1)*P_dark + (1-exp(-n))*P_bright
print("Contrast: " + str(c) + "%")
In [7]:
result = contrast(10, 90, -110, 5, 5)
In [8]:
def qe(P_dark, P_bright, power, length, freq):
n = N(power, length, freq)
eta = (P_switch(P_dark, P_bright, power, length, freq) - exp(-n)*P_dark)/(1-exp(-n))**2
print ("Quantum Efficiency:" + str(eta) + "%")
return eta
In [9]:
result = qe(10., 50., -110., 5., 5.)
In [66]:
In [ ]: